package com.mxpio.erp.common.oa.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.annotation.DictValue;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_OA_REWARD_PUNISHMENT")
@Schema(description="OA奖惩单")
public class OaRewardPunishment extends BaseEntity {

    @Id
    @Column(name = "BIZ_NO_", updatable = false)
    @Generator(policy = ResCodeGeneratorPolicy.class)
    @Schema(description = "工单编号")
    private String bizNo;

    @Column(name = "EMPLOYEE_NAME_")
    @Schema(description = "员工工号")
    @Dict(dicCode="username", dicEntity = User.class, dicText = "nickname")
    private String employeeId;

    @Column(name = "EMPLOYEE_POST_")
    @Schema(description = "员工职位")
    private String employeePost;

    @Column(name = "DEPT_CODE_")
    @Schema(description = "部门编号")
    @Dict(dicCode="deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String deptCode;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @Schema(description = "申请时间")
    @Column(name = "APPLY_TIME_")
    private Date applyTime;

    @Schema(description = "奖惩事由详述")
    @Column(name = "RP_REASON_")
    private String rpReason;

    @Schema(description = "奖惩依据")
    @Column(name = "RP_VOUCHER_")
    @Dict(dicCode = "MB_ERP_OA_RP_VOUCHER")
    @DictValue(value = "10=《质量考核标准》,20=其他")
    private String rpVoucher;

    @Schema(description = "奖惩结果")
    @Column(name = "RP_RESULT_")
    @Dict(dicCode = "MB_ERP_OA_RP_RESULT")
    @DictValue(value = "10=书面批评,20=书面表扬,30=扣款,40=奖励,50=其他")
    private String rpResult;

    @Schema(description = "奖惩结果值")
    @Column(name = "RP_RESULT_VALUE_")
    private String rpResultValue;


    /**审批状态*/
    @Column(name = "BPMN_STATUS_")
    @Schema(description = "审批状态")
    @Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
    private String bpmnStatus;

    /**审批实例ID*/
    @Column(name = "PROCESS_INSTANCE_ID_")
    @Schema(description = "审批实例ID")
    private String processInstanceId;
}
